home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Atari Compendium
/
The Atari Compendium (Toad Computers) (1994).iso
/
files
/
umich
/
tex
/
texchang.arc
/
weave
< prev
Wrap
Text File
|
1990-03-16
|
7KB
|
278 lines
WEAVE change file for the Atari ST
Author: Nico Poppelier.
Date : December 30, 1988.
Increased max_refs and max_toks as in Version 2.6.
Due to an error in the Prospero Pascal compiler the control
variable of the FOR loop in section 85 is judged 'insecure',
i.e., it looks as if it is modified by a routine.
To avoid this error a new loop variable k is introduced.
@x
\pageno=\contentspagenumber \advance\pageno by 1
@y
\pageno=\contentspagenumber \advance\pageno by 1
% \let\maybe=\iffalse
% \def\title{WEAVE changes for the Atari ST}
\def\title{WEAVE, Version 2.8 for the Atari ST}
@z
@x
@d banner=='This is WEAVE, Version 2.8'
@y
@d banner=='This is WEAVE, Version 2.8 for the Atari ST'
@z
@x
and |change_file|, and the \TeX\ output goes to file |tex_file|.
@y
and |change_file|, and the \TeX\ output goes to file |tex_file|.
Prospero Pascal requires us to mention |input| and |output|
in the program header, too.
They are used for terminal input and output.
@z
@x
program WEAVE(@!web_file,@!change_file,@!tex_file);
@y
program WEAVE(@!input,@!output,
@!web_file,@!change_file,@!tex_file);
@z
@x
procedure initialize;
@y
procedure wait(delay:real); external;
procedure initialize;
@z
@x
begin @<Set initial values@>@/
@y
begin @<Preset initial values@>@/
@<Set initial values@>@/
@z
@x
@d debug==@{ {change this to `$\\{debug}\equiv\null$' when debugging}
@d gubed==@t@>@} {change this to `$\\{gubed}\equiv\null$' when debugging}
@y
@d debug== {we are debugging}
@d gubed==
@z
@x
@d stat==@{ {change this to `$\\{stat}\equiv\null$'
when gathering usage statistics}
@d tats==@t@>@} {change this to `$\\{tats}\equiv\null$'
when gathering usage statistics}
@y
@d stat== {we are gathering usage statistics}
@d tats==
@z
@x
@<Compiler directives@>=
@{@&$C-,A+,D-@} {no range check, catch arithmetic overflow, no debug overhead}
@!debug @{@&$C+,D+@}@+ gubed {but turn everything on when debugging}
@y
On the Atari ST, things are a bit different:
Prospero Pascal does not allow in-comment directives.
@<Compiler directives@>=
@z
@x
@d othercases == others: {default for cases not listed explicitly}
@y
@d othercases == otherwise {default for cases not listed explicitly}
@z
@x
@!max_refs=20000; {number of cross references; must be less than 65536}
@!max_toks=20000; {number of symbols in \PASCAL\ texts being parsed;
@y
@!max_refs=30000; {number of cross references; must be less than 65536}
@!max_toks=30000; {number of symbols in \PASCAL\ texts being parsed;
@z
@x
@!text_file=packed file of text_char;
@y
@!text_file=text;
@z
@x
@d print(#)==write(term_out,#) {`|print|' means write on the terminal}
@y
@d term_in==input
@d term_out==output
@d print(#)==write(term_out,#) {`|print|' means write on the terminal}
@z
@x
@!term_out:text_file; {the terminal as an output file}
@y
@z
@x
rewrite(term_out,'TTY:'); {send |term_out| output to the terminal}
@y
@z
@x
@d update_terminal == break(term_out) {empty the terminal output buffer}
@y
@d update_terminal == {emptying the output buffer is not necessary}
@z
@x
@ The following code opens |tex_file|.
Since this file was listed in the program header, we assume that the
\PASCAL\ runtime system has checked that a suitable external file name has
been given.
@^system dependencies@>
@<Set init...@>=
rewrite(tex_file);
@y
@ The following code opens |tex_file|.
Actually, on the Atari ST this task is put off until later.
@^system dependencies@>
@z
@x
@!loc:0..long_buf_size; {the next character position to be read from the buffer}
@y
@!loc:0..long_buf_size; {the next character position to be read from the buffer}
@!k:integer; {extra loop variable}
@z
@x
begin for loc:=0 to change_limit do buffer[loc]:=change_buffer[loc];
@y
begin for k:=0 to change_limit do buffer[k]:=change_buffer[k];
@z
@x
@!term_in:text_file; {the user's terminal as an input file}
@y
@z
@x
reset(term_in,'TTY:','/I'); {open |term_in| as the terminal, don't do a |get|}
@y
@z
@x
print_ln(banner); {print a ``banner line''}
@y
@z
@x
@t\4\4@>{here files should be closed if the operating system requires it}
@<Print the job |history|@>;
end.
@y
if history<fatal_message then
@= close@>(tex_file, true);
@<Print the job |history|@>; wait(3);
end.
@z
@x
This module should be replaced, if necessary, by changes to the program
that are necessary to make \.{WEAVE} work at a particular installation.
It is usually best to design your change file so that all changes to
previous modules preserve the module numbering; then everybody's version
will be consistent with the printed program. More extensive changes,
which introduce new modules, can be inserted here; then only the index
itself will get a new module number.
@y
Here are the remaining changes to the program
that are necessary to make \.{WEAVE} work on the Atari ST.
@ @<Local...@>=
@!ask,@!name_found:boolean;
@!file_name,@!job_name:s @& t @& r @& i @& n @& g;
@!name_length,@!name_index: integer;
@ Get the external file names, and then call |open|
to associate an external file with each file variable.
@<Preset init...@>=
print_ln(banner); {print a ``banner'' line}
getcomm(job_name);
name_length:=l @& e @& n @& g @& t @& h(job_name); name_index:=1;
while (name_index <= name_length) and
(job_name[name_index] = ' ') do incr(name_index);
name_found:=name_index <= name_length;
if name_found then delete(job_name, 1, name_index-1);
if name_found then begin
file_name:=concat(job_name,'.WEB');
assign(web_file,file_name);
ask:=not fstat(file_name);
if ask then write_ln('Couldn''t open ',file_name);
end
else ask:=true;
while ask do begin
write('Web file: ');
if eof then begin mark_fatal; jump_out; end;
read_ln(file_name);
if checkfn(file_name) then begin
ask:= not fstat(file_name);
if ask then write_ln('Couldn''t open ',file_name)
else assign(web_file,file_name);
end
else begin
ask:=true; write_ln('"',file_name,'" is not a good filename')
end;
end;
if name_found then begin
file_name:=concat(job_name,'.CH');
assign(change_file,file_name);
ask:=not fstat(file_name);
if ask then write_ln('Couldn''t open ',file_name);
end
else ask:=true;
while ask do begin
write('Change file: ');
if eof then begin mark_fatal; jump_out; end;
read_ln(file_name);
if file_name='' then file_name:='empty.ch';
if checkfn(file_name) then begin
ask:=not fstat(file_name);
if ask then write_ln('Couldn''t open ',file_name)
else assign(change_file,file_name);
end
else begin
ask:=true; write_ln('"',file_name,'" is not a good filename')
end;
end;
if name_found then begin
file_name:=concat(job_name,'.TEX');
assign(tex_file,file_name);
ask:=not checkfn(file_name);
if ask then write_ln('"',file_name,'" is not a good filename')
end
else ask:=true;
while ask do begin
write('TeX file: ');
if eof then begin mark_fatal; jump_out; end;
read_ln(file_name);
ask := not checkfn(file_name);
if ask then
write_ln('"',file_name,'" is not a good filename')
else
assign(tex_file,file_name);
end;
rewrite(tex_file);
@z